const handler = {
  get:function(obj,prop){
    console.log('obj: ', obj) //obj:  {a: 1}
    console.log('prop: ', prop) //prop:  a
    //*默认行为是返回属性值
    return obj[prop]
  },
  set:function(obj,prop,value){
    if(prop==='age'){
      if(!Number.isInteger(value)){ //判断是否是整数
        throw new TypeError('The age is not an integer')
      }
    }

    // 默认行为是保存属性值
    obj[prop] = value
  }
}
const p = new Proxy({},handler)
p.a = 1
console.log(p.a)

p.age = 123
p.age = 'young'
